package com.wtwd.device.model;

import com.wtwd.device.constant.SeparatorConstant;

import java.io.Serializable;
import java.util.List;

public class NormalButton implements Serializable {
    /**
     * 按键
     */
    private Byte button;

    /**
     * 昵称
     */
    private String nickName;

    /**
     * 电话号码
     */
    private String telephone;

    public NormalButton() {
    }

    public Byte getButton() {
        return button;
    }

    public void setButton(Byte button) {
        this.button = button;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public static String serialization(List<NormalButton> list){
        StringBuffer stringBuffer = new StringBuffer();
        for(int i = 0;i < list.size();i++){
            NormalButton normalButton = list.get(i);
            String s = normalButton.getButton() + SeparatorConstant.EQUAL_SIGN_SPLIT + normalButton.getTelephone() + SeparatorConstant.PLUS_SIGN_SPLIT + normalButton.getNickName();
            stringBuffer.append(s);
            if(i + 1 < list.size()){
                stringBuffer.append(SeparatorConstant.LOCATION_SPLIT);
            }
        }
        return stringBuffer.toString();
    }

    @Override
    public String toString() {
        return "NormalButton{" +
                "button=" + button +
                ", nickName='" + nickName + '\'' +
                ", telephone='" + telephone + '\'' +
                '}';
    }
}
